import request from '@/utils/request'

import { baseUrlConfig } from '@/config/config'
const basePath = baseUrlConfig.processBaseUrl

export interface PageListType {
  pageNum: number
  pageSize: number
  condition: {
    eventName?: string
    occurTimeStart?: string
    occurTimeEnd?:string
    eventTypeIds?:number[]
  }
  order?:{
    column?: string | undefined
    method?: string | undefined
  }[]
}

// 获取分页列表
export const getPageList: (data: any) => Promise<[]> = (data) => {
  return request({
    url: basePath + '/event/record/pageList',
    method: 'post',
    data
  })
}

// 导出
export const exportList: (data: any) => Promise<[]> = (data) => {
  return request({
    responseType: 'blob',
    url: basePath + '/event/record/export',
    method: 'post',
    data
  })
}

// 填报
export const eventFill: (data: any) => Promise<[]> = (data) => {
  return request({
      url: basePath + '/event/record/update',
      method: 'post',
      data
  })
}

export const toKnowledge: (id: any) => Promise<[]> = (id) => {
  return request({
      url: basePath + `/event/record/eventToKnowledge?id=${id}`,
      method: 'get',
  })
}
